﻿using Nop.Core.Domain.Security;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Nop.Data.Mapping.Security
{
    public partial class PermissionMap : NopEntityTypeConfiguration<Permission>
    {
        public PermissionMap()
        {
            this.ToTable("Permission");
            this.HasKey(c => c.Id);

            this.Property(p => p.Name).IsRequired().HasMaxLength(50);
            this.Property(p => p.SystemName).IsRequired().HasMaxLength(50);

            this.HasMany(pr => pr.CustomerRoles)
                .WithMany(cr => cr.Permissions)
                .Map(m => m.ToTable("Permission_Role_Mapping"));

        }
    }
}
